#include "ShapeEntity.h"
#include "SceneNode.h"
#include "Camera.h"

namespace egg{

    ShapeEntity::ShapeEntity(){
        mMvpMatrix=mParamMap.getNumericParam("uni_mat4_mvp");
    }

    void ShapeEntity::onAttached(SceneNode* node){
    }

    void ShapeEntity::_draw(const FrameEvent& evt){
        const mat4& proj=evt.mCamera->getProjectionMatrix();
        const mat4& view=evt.mCamera->getViewMatrix();
        const mat4& model=mNode->getAbsTransform();
        mMvpMatrix->set<mat4>(proj*view*model);
        mParamMap._commitParams(evt.mFrameID);
        mGeometry->draw();
    }

    RenderPriority ShapeEntity::getPriority(){
        return RP_SHAPE;
    }

}